<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><head>
      <#include "/common/elibs.html">
    <!-- 让IE8/9支持媒体查询，从而兼容栅格 -->
  </head>
  <script>var index;
  </script><body>
    <div class="x-body">
        <form class="layui-form">
            <input type="hidden" name="idxProAdmin" id="idxProAdmin" value="${id}"/>
            <div class="layui-form-item">
                <label class="layui-form-label">
                    开始时间
                </label>
                <div class="layui-input-inline">
                    <input type="text" id="beginTime" name="beginTime"
                           autocomplete="off" class="layui-input" disabled style="background-color: #b7b1b1;">
                </div>
            </div>

            <div class="layui-form-item">
                <label class="layui-form-label">
                    结束时间
                </label>
                <div class="layui-input-inline">
                    <input type="text" id="endTime" name="endTime"
                           autocomplete="off" class="layui-input" disabled style="background-color: #b7b1b1;">
                </div>
            </div>

            <div class="layui-form-item">
                <label class="layui-form-label">
                    距离结束时间天数
                </label>
                <div class="layui-input-inline">
                    <input type="text" id="differenceTime" name="differenceTime"
                           autocomplete="off" class="layui-input" disabled style="background-color: #b7b1b1;">
                </div>
            </div>


            <div class="layui-form-item">
                <label for="idxSysFilesListFile1" class="layui-form-label">
                    <span class="x-red">*</span>送电申请书：<br/>
                </label>
                <div class="layui-input-inline" >
                    <img class="layui-upload-img" src="" id="imgUrl1" width="100px" /><br><br><br>
                    <input type="hidden" name="idxSysFilesListFile" id="idxSysFilesListFile1" >
                    <button type="button" class="layui-btn" id="upload1">
                        <i class="layui-icon">&#xe67c;</i>上传文件
                    </button>
                    <script>
                        updateFile("upload1","imgUrl1","idxSysFilesListFile1");
                    </script>
                    <br>
                    <img class="layui-upload-img" src="" id="imgUrl2" width="100px" /><br><br><br>
                    <input type="hidden" name="idxSysFilesListFile" id="idxSysFilesListFile2"   >
                    <button type="button" class="layui-btn" id="upload2">
                        <i class="layui-icon">&#xe67c;</i>上传文件
                    </button>
                    <script>
                        updateFile("upload2","imgUrl2","idxSysFilesListFile2");
                    </script>
                    <br>

                    <img class="layui-upload-img" src="" id="imgUrl3" width="100px" /><br><br><br>
                    <input type="hidden" name="idxSysFilesListFile" id="idxSysFilesListFile3"   >
                    <button type="button" class="layui-btn" id="upload3">
                        <i class="layui-icon">&#xe67c;</i>上传文件
                    </button>
                    <script>
                        updateFile("upload3","imgUrl3","idxSysFilesListFile3");
                    </script>
                    <br>
                    <img class="layui-upload-img" src="" id="imgUrl4" width="100px" /><br><br><br>
                    <input type="hidden" name="idxSysFilesListFile" id="idxSysFilesListFile4"   >
                    <button type="button" class="layui-btn" id="upload4">
                        <i class="layui-icon">&#xe67c;</i>上传文件
                    </button>
                    <script>
                        updateFile("upload4","imgUrl4","idxSysFilesListFile4");
                    </script>
                </div>
            </div>

            <div class="layui-form-item">
                <label for="commissioningApproval1" class="layui-form-label">
                    <span class="x-red">*</span>设备投运批准书：<br/>
                </label>
                <div class="layui-input-inline" >
                    <img class="layui-upload-img" src="" id="imgUrl5" width="100px" /><br><br><br>
                    <input type="hidden" name="commissioningApproval" id="commissioningApproval1" >
                    <button type="button" class="layui-btn" id="upload5">
                        <i class="layui-icon">&#xe67c;</i>上传文件
                    </button>
                    <script>
                        updateFile("upload5","imgUrl5","commissioningApproval1");
                    </script>
                    <br>
                    <img class="layui-upload-img" src="" id="imgUrl6" width="100px" /><br><br><br>
                    <input type="hidden" name="commissioningApproval" id="commissioningApproval2"   >
                    <button type="button" class="layui-btn" id="upload6">
                        <i class="layui-icon">&#xe67c;</i>上传文件
                    </button>
                    <script>
                        updateFile("upload6","imgUrl6","commissioningApproval2");
                    </script>
                    <br>

                    <img class="layui-upload-img" src="" id="imgUrl7" width="100px" /><br><br><br>
                    <input type="hidden" name="commissioningApproval" id="commissioningApproval3"   >
                    <button type="button" class="layui-btn" id="upload7">
                        <i class="layui-icon">&#xe67c;</i>上传文件
                    </button>
                    <script>
                        updateFile("upload7","imgUrl7","commissioningApproval3");
                    </script>
                    <br>
                    <img class="layui-upload-img" src="" id="imgUrl8" width="100px" /><br><br><br>
                    <input type="hidden" name="commissioningApproval" id="commissioningApproval4"   >
                    <button type="button" class="layui-btn" id="upload8">
                        <i class="layui-icon">&#xe67c;</i>上传文件
                    </button>
                    <script>
                        updateFile("upload8","imgUrl8","commissioningApproval4");
                    </script>
                </div>
            </div>

            <div class="layui-form-item">
                <label for="accessNetworkApproval1" class="layui-form-label">
                    <span class="x-red">*</span>加入电网批准书：<br/>
                </label>
                <div class="layui-input-inline" >
                    <img class="layui-upload-img" src="" id="imgUrl9" width="100px" /><br><br><br>
                    <input type="hidden" name="accessNetworkApproval" id="accessNetworkApproval1" >
                    <button type="button" class="layui-btn" id="upload9">
                        <i class="layui-icon">&#xe67c;</i>上传文件
                    </button>
                    <script>
                        updateFile("upload9","imgUrl9","accessNetworkApproval1");
                    </script>
                    <br>
                    <img class="layui-upload-img" src="" id="imgUrl10" width="100px" /><br><br><br>
                    <input type="hidden" name="accessNetworkApproval" id="accessNetworkApproval2"   >
                    <button type="button" class="layui-btn" id="upload10">
                        <i class="layui-icon">&#xe67c;</i>上传文件
                    </button>
                    <script>
                        updateFile("upload10","imgUrl10","accessNetworkApproval2");
                    </script>
                    <br>

                    <img class="layui-upload-img" src="" id="imgUrl11" width="100px" /><br><br><br>
                    <input type="hidden" name="accessNetworkApproval" id="accessNetworkApproval3"   >
                    <button type="button" class="layui-btn" id="upload11">
                        <i class="layui-icon">&#xe67c;</i>上传文件
                    </button>
                    <script>
                        updateFile("upload11","imgUrl11","accessNetworkApproval3");
                    </script>
                    <br>
                    <img class="layui-upload-img" src="" id="imgUrl12" width="100px" /><br><br><br>
                    <input type="hidden" name="accessNetworkApproval" id="accessNetworkApproval4"   >
                    <button type="button" class="layui-btn" id="upload12">
                        <i class="layui-icon">&#xe67c;</i>上传文件
                    </button>
                    <script>
                        updateFile("upload12","imgUrl12","accessNetworkApproval4");
                    </script>
                </div>
            </div>


            <div class="layui-form-item">
                <label for="" class="layui-form-label">
                </label>
                <button  class="layui-btn" lay-filter="preservation" type=button codeTyle="1" lay-submit="">
                    保存
                </button>
                <button  class="layui-btn" lay-filter="preAdd" type=button codeTyle="2" lay-submit="">
                    预提交
                </button>
                <button  class="layui-btn" lay-filter="add" type=button codeTyle="3" lay-submit="">
                    提交
                </button>
            </div>
      </form>
    </div>
    <script>

        $(function(){
            getProTime($("#idxProAdmin").val(),40);
        })

        layui.use(['form','layer'], function() {
            $ = layui.jquery;
            var form = layui.form
                , layer = layui.layer, layedit = layui.layedit;

            //自定义验证规则
            form.verify({});

            //监听提交
            form.on('submit(add)', function (t) {
                addSubmit(3);
            });

            //监听保存
            form.on('submit(preservation)', function (t) {
                addSubmit(1);
            });

            //监听预提交
            form.on('submit(preAdd)', function (t) {
                addSubmit(2);
            });

        });

        function addSubmit(submitState){

            var idxSysFilesListFile=new Array(),i = 0;
            $("input[name='idxSysFilesListFile']").each(function(){
                if(isNotNull($(this).val())){
                    var data = {
                        idSysFiles: $(this).val(),
                        resourcesType : 1
                    };
                    idxSysFilesListFile[i] = data;
                    i++;
                }
            })

            var commissioningApproval=new Array(),i = 0;
            $("input[name='commissioningApproval']").each(function(){
                if(isNotNull($(this).val())) {
                    var data = {
                        idSysFiles: $(this).val(),
                        resourcesType: 2
                    };
                    commissioningApproval[i] = data;
                    i++;
                }
            })

            var accessNetworkApproval=new Array(),i = 0;
            $("input[name='accessNetworkApproval']").each(function(){
                if(isNotNull($(this).val())) {
                    var data = {
                        idSysFiles: $(this).val(),
                        resourcesType: 3
                    };
                    accessNetworkApproval[i] = data;
                    i++;
                }
            })
            var params = {
                //tcaDescribe : layui.layedit.getContent(index),
                "idProAdmin": $("#idxProAdmin").val(),
                "idxSysFilesListFile": idxSysFilesListFile,
                "commissioningApprovalListFile": commissioningApproval,
                "accessNetworkApprovalListFile": accessNetworkApproval,
                "submitState":submitState
            }
            if (true) {
                ajaxFun('post','/pc/project/addPowerTransmissionStartUp',JSON.stringify(params),function(data){
                    if (data.code != 0) {
                        alertFun(data);
                    } else {
                        window.location.href = path + "/modules/project/threePro/sdqd/list.html";
                        console.log("success !");
                    }
                })
                return false;
            }
        }
    </script></body></html>